﻿Imports System.Data.SqlClient

Public Class Form1
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ' tek bir alanı göstermek için en kolay yol
        'lbIller.DataSource = Sorgula("select * from iller order by ilID")
        ' lbIller.DisplayMember = "ilAdi"

        ' birden çok alanı listboxta göstermek için
        Dim butunIller = Sorgula("select * from iller order by ilID")
        For Each il In butunIller.Rows
            lbIller.Items.Add(il("ilAdi") & " " & il("ilID"))
        Next
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        dgvIller.DataSource = Sorgula("select * from iller order by ilID")

    End Sub

    Private Sub Insert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Insert.Click
        Dim sorgu As String = "INSERT INTO iller (ilAdi) VALUES ('" &
            temizle(tbEklenecekIl.Text) &
            "')"

        Sorgula(sorgu)
    End Sub

End Class
